# 测试多个状态码随机返回
import requests

def test_multiple_status_codes(method, codes):
    codes_str = ",".join(map(str, codes))
    url = f"https://httpbin.org/status/{codes_str}"
    try:
        response = requests.request(method, url)
        print(f"Method: {method}, URL: {url}")
        print(f"Response Status Code: {response.status_code}")
    except requests.RequestException as e:
        print(f"Error for {method} {url}: {e}")

test_multiple_status_codes("GET", [200, 404, 500])
test_multiple_status_codes("POST", [400, 403, 502])
test_multiple_status_codes("DELETE", [400, 403, 502])
test_multiple_status_codes("PATCH", [400, 403, 502])
test_multiple_status_codes("PUT", [400, 403, 502])
